from django.db import models
from base import *
from object_types import *
from simdb import *
from protocol import *
from experiment import *

_model_names = ["WebService"]
__all__ = _model_names + ["SERVICE_TYPES"]

SERVICE_TYPES = (("download", "Represents a service that allows one to download a snapshot."),
                ("cutout", "Represents a SimDAP service that defines a cut-out operation on an existing snapshot."),
                ("gridding", "Represents a SimDAP service that defines a (re)gridding operation on an existing snapshot."),
                ("clusterfinder", "Represents a SimDAP service that defines a cluster-finder operation on an existing snapshot, supposedly of an N-body simulation."),
                ("visualisation", "Represents a SimDAP service that defines a visualisation operation on an existing snapshot, producing a 2 dimensional grid."),
                ("custom", "Thie represents a general, unspecified online operation on a simulation. It may be of any kind, no restriction on interface."))

class WebService(Resource):
    """
    Service that provide access to either existing either
    existing Experiment results (i.e., Snapshots), or use
    a Protocol to create new Experiments.
    """

    _collection_sets = []
    baseurl = models.URLField(blank=True, null=True)
    registryid = models.URLField(null=True)
    type = models.CharField(max_length=256, choices=SERVICE_TYPES, 
                            default='download')
    collections = models.ManyToManyField(DataCollection)
